#include "widget.h"
#include "ui_widget.h"
#include <QPushButton>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    QPushButton *btn = new QPushButton("按钮", this);
    resize(800, 600);

    connect(this, &Widget::MySignal, this, &Widget::MySlot);

    connect(btn, &QPushButton::clicked, this, &Widget::MySignal);
    ui->setupUi(this);
}

void Widget::MySlot()
{
    qDebug() << "好好学习，天天向上";
}
void Widget::EmitSignal()
{
    emit MySignal();
}
Widget::~Widget()
{
    delete ui;
}
